package com.david.zhufengfm.entity.discoverrecommend;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by David on 2015/10/22.
 * qq:978944820
 */
public class DiscoverRecommendFocus extends DiscoverRecommendItem {
    private int ret;
    private List<FocusRecommend>focusList;
    public void parseJSON(JSONObject json) throws JSONException {
        //调用父类的解析，解析分类需要使用的数据
        //因为super中包含了title和hasMore
        super.parseJson(json);
        ret=json.optInt("ret",0);
        JSONArray array = json.getJSONArray("list");
        int len=array.length();
        focusList=new LinkedList<>();
        for (int i = 0; i < len; i++) {
            JSONObject jsonObject=array.getJSONObject(i);
            FocusRecommend focusRecommend= new FocusRecommend();
            focusRecommend.parseJSON(jsonObject);
            focusList.add(focusRecommend);

        }
    }

    public int getRet() {
        return ret;
    }

    public List<FocusRecommend> getFocusList() {
        return focusList;
    }
}
